package com.orhon.smartcampus.modules.material.mm;


import java.util.List;

import org.mapstruct.InheritConfiguration;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.factory.Mappers;

import com.orhon.smartcampus.modules.base.mm.LangMapper;
import com.orhon.smartcampus.modules.base.mm.SchoolMapper;
import com.orhon.smartcampus.modules.material.entity.Unit;
import com.orhon.smartcampus.modules.material.gqlModel.GQLUnit;

@Mapper(
        uses = {
                LangMapper.class,
                BuildingMapper.class,
                SchoolMapper.class
        }
)
public interface UnitMapper {


    UnitMapper MAPPER = Mappers.getMapper(UnitMapper.class);


    @Mapping(source = "id" , target = "id")
    @Mapping(source = "unitCode" , target = "code")
    @Mapping(source = "unitTel" , target = "tel")
    @Mapping(source = "floorNum" , target = "floor_num")
    @Mapping(source = "unitManager" , target = "manager")
    @Mapping(source = "unitName" , target = "name")
    @Mapping(ignore = true, target = "building" )
    @Mapping(ignore = true, target = "school" )
    @Mapping(source = "createdAt" , target = "created_at")
    @Mapping(source = "updatedAt" , target = "updated_at")
    GQLUnit toUnit(Unit entity);
    
    @InheritConfiguration(name = "toUnit")
    List<GQLUnit> toUnitList(List<Unit> entities);
}
